import numpy as np

def cul():
    results = []
    p0 = 1.0133
    for i in range(6):
        print(f"请输入第{i+1}组数据")
        u1 = float(input("第一个电压>"))
        u2 = float(input("第二个电压>"))
        p1 = p0 + u1 / 2000
        p2 = p0 + u2 / 2000
        rate1 = p1 / p0
        rate2 = p1 / p2
        logValue1 = np.log10(rate1)
        logValue2 = np.log10(rate2)
        result = {
            "u1": u1,  # 修改键名，去掉">"
            "u2": u2,
            "p1": p1,
            "rate1": rate1,
            "logValue1": logValue1,
            "p2": p2,
            "rate2": rate2,
            "logValue2": logValue2
        }
        results.append(result)
    return results  # 将return移到循环外

# 执行计算
results = cul()

# 显示结果
print("\n计算结果:")
for index, result_dict in enumerate(results):  # 使用enumerate获取索引
    print(f"第{index+1}组，其中u1为{result_dict['u1']}，u2为{result_dict['u2']}")  # 使用单引号嵌套双引号
    print(f"p1为{result_dict['p1']}，p2为{result_dict['p2']}")
    print(f"p1/p0为{result_dict['rate1']}, p1/p2为{result_dict['rate2']}")
    print(f"lg(p1/p0)为{result_dict['logValue1']}，lg(p1/p2)为{result_dict['logValue2']}")
    print()